package vip.xiaozhao.paotui.intf.enums;


public enum PaotuiTypeEnum {

    All(0, "所有"),
    Cloth(1, "衣服"),
    Food(2, "食品"),
    Book(3, "书籍"),
    ForLife(4, "生活物品"),
    Other(5, "其它");

    private int id;
    private String name;


    PaotuiTypeEnum(int id, String name) {
        this.id = id;
        this.name = name;
    }

    public static PaotuiTypeEnum getById(int id) {
        for (PaotuiTypeEnum type : PaotuiTypeEnum.values()) {
            if (type.getId() == id)
                return type;
        }
        return null;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    /**
     * Getter method for property <tt>name</tt>.
     *
     * @return property value of name
     */
    public String getName() {
        return name;
    }

    /**
     * Setter method for property <tt>name</tt>.
     *
     * @param name value to be assigned to property name
     */
    public void setName(String name) {
        this.name = name;
    }

    public static void main(String[] args) {
        System.out.println(getById(1).getName());
    }

}
